package groups.geographics.gui;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;

import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.WindowConstants;

import java.sql.Connection;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;


/**
 * This code was edited or generated using CloudGarden's Jigloo
 * SWT/Swing GUI Builder, which is free for non-commercial
 * use. If Jigloo is being used commercially (ie, by a corporation,
 * company or business for any purpose whatever) then you
 * should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details.
 * Use of Jigloo implies acceptance of these licensing terms.
 * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
 * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
 * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
/**
 * 
 */
public class InitGeographics extends JFrame {
	private JPanel topPanel;
	private JButton countryButton;
	private JButton biomeButton;
	private JButton habitatButton;
	private Connection con;

	public InitGeographics(Connection con) {
		super("Geografia");
		this.con=con;
		initGUI();
	}

	private void initGUI() {
		try{
			setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
			topPanel = new JPanel();
			getContentPane().add(topPanel, BorderLayout.CENTER);
			topPanel.setPreferredSize(new java.awt.Dimension(184, 102));
			{
				countryButton = new JButton();
				topPanel.add(countryButton);
				countryButton.setName("countryButton");
				countryButton.setPreferredSize(new java.awt.Dimension(122, 25));
				countryButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("countryButton.actionPerformed, event="+evt);
						JFrame countryGUI = new CountryGUI(con);
						countryGUI.setVisible(true);
					}
				});
			}
			{
				biomeButton = new JButton();
				topPanel.add(biomeButton);
				biomeButton.setPreferredSize(new java.awt.Dimension(122
						, 25));
				biomeButton.setName("biomeButton");
				biomeButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("biomeButton.actionPerformed, event="+evt);
						JFrame biomeGUI = new BiomeGUI(con);
						biomeGUI.setVisible(true);
					}
				});
			}
			{
				habitatButton = new JButton();
				topPanel.add(habitatButton);
				habitatButton.setPreferredSize(new java.awt.Dimension(122, 25));
				habitatButton.setName("habitatButton");
				habitatButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("habitatButton.actionPerformed, event="+evt);
						JFrame habitatGUI = new HabitatGUI(con);
						habitatGUI.setVisible(true);
					}
				});
			}
			pack();
			this.setSize(178, 140);
			Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(getContentPane());
		}
		catch (Exception e) {
			//add your error handling code here
			e.printStackTrace();
		}
	}
}
